var express = require("express");
var {
  createGoods,
  createGoodsCategory,
  createGoodsDetail,
} = require("../controller/goods/createGoods");
var {
  findGoodsList,
  findGoodsCategoryList,
  findGoodsDetail,
} = require("../controller/goods/findGoods");
var router = express.Router();

router.get("/getGoods", async function (req, res, next) {
  const data = await findGoodsList();
  res.json(data);
});

router.get("/getGoodsCategory", async function (req, res, next) {
  const data = await findGoodsCategoryList();
  res.json(data);
});
router.post("/createGoods", async function (req, res, next) {
  const data = await createGoods(req.body);
  res.json(data);
});

router.post("/createGoodsCategory", async function (req, res, next) {
  const data = await createGoodsCategory(req.body);
  res.json(data);
});

router.post("/createGoodsDetail", async function (req, res, next) {
  const data = await createGoodsDetail(req.body);
  res.json(data);
});

router.post('/findGoodsDetail',async function (req,res){
  const data=await findGoodsDetail(req.body)
  res.json(data);
});

module.exports = router;
